import React from 'react';
import { Modal } from 'antd';
import { useUnDoneSubTaskList } from '@/pages/Task/hooks';
import { TipBox, ModalTable } from '@/pages/Task/components';
import { MODAL_DEFAULT_PARAM, MODAL_FORCE_PARAM } from '@/pages/Task/components/InfoModal/config';
// 转进行中--- 存在子任务列表时弹框提示
const Content = ({ taskId }) => (
    <>
        <TipBox title="无法转至已完成！" content="当前任务下存在未完成的子任务" />
        <ModalTable taskId={taskId} loadData={useUnDoneSubTaskList} type="cancel" title="进行中子任务清单" />
    </>
);

export const showTurnFinishExistsOnDoningSubInfoModal = ({ taskId, ...rest }) => {
    const modalParams = { ...MODAL_DEFAULT_PARAM, ...rest, ...MODAL_FORCE_PARAM };
    Modal.info({
        ...modalParams,
        title: '转已完成',
        content: <Content taskId={taskId} />
    });
};
